import jsonp from "jsonp";

export default function getJson(path, action) {
  return new Promise((resolve) => {
    jsonp(
      path,
      {
        jsonpCallback: "callback",
        prefix: "callback",
        name: action,
        timeout: 2000
      },
      (err, res) => {
        resolve(res);
      }
    );
  });
}
